package ar.edu.unicen.exa.oop.bbquery.facade;

import org.puremvc.java.multicore.patterns.facade.Facade;

import ar.edu.unicen.exa.oop.bbquery.controller.commands.DataSubmittedCommand;
import ar.edu.unicen.exa.oop.bbquery.controller.commands.StartupCommand;

public class AppFacade extends Facade {

	protected AppFacade(String key) {
		super(key);
	}

	protected static final String FACADE_NAME = "my_facade";
	public static final String STARTUP = "STARTUP";
	public static final String DATA_SUBMITTED = "DATA_SUBMITTED";
	public static final String DATA_CHANGED = "DATA_CHANGED";

	private static AppFacade instance = null;

	public static AppFacade getInst() {
		if (instance == null) {
			instance = new AppFacade(FACADE_NAME);
		}
		return (AppFacade) instance;
	}

	@Override
	protected void initializeController() {
		super.initializeController();
		registerCommand(STARTUP, new StartupCommand());
		registerCommand(DATA_SUBMITTED, new DataSubmittedCommand());
	}

	public void startup() {
		sendNotification(STARTUP, this);
	}
}
